package edu.ynu.se.xiecheng.achitectureclass.dao;

import edu.ynu.se.xiecheng.achitectureclass.common.dao.LogicDAO;
import edu.ynu.se.xiecheng.achitectureclass.dto.DataDTO;
import edu.ynu.se.xiecheng.achitectureclass.entity.SoilWaterDataEntity;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface SoilWaterDataDao extends LogicDAO<SoilWaterDataEntity, Long> {

    @Query("SELECT new edu.ynu.se.xiecheng.achitectureclass.dto.DataDTO(cd.id, cd.createTime, cd.dataValue) " +
            "FROM SoilWaterDataEntity cd WHERE cd.isDeleted = 0 ORDER BY cd.createTime DESC")
    List<DataDTO> findLatestTenSoilWaterData(Pageable pageable);
}
